<?php

require_once APPPATH . 'dao/configurationManager.php';

class BasicViewer extends CI_Controller {

    public function index() {

        if ($this->session->userdata('logged_in')) {
            add_css(array('/assets/css/basicViewer.css'));
            add_js(array('assets/libs/jqGrid/js/jquery-1.9.0.min.js', 'assets/libs/Openlayers/OpenLayers.js',
                'assets/js/util.js', 'assets/js/basicVisualizator.js'));
            $this->load->view('pages/header');
            $this->load->view('pages/basicViewer');
            $this->load->view('pages/footer');
        } else {
            redirect('/login');
        }
    }

    public function getLayerData($layer) {
       
        $layerData = ConfigurationManager::getInstance()->getTilesetGrids($layer);
        
        if ($layerData ) {
            echo json_encode($layerData);
        } else {
            echo json_encode(null);
        }
    }

}
